<?php

namespace App\Http\Controllers\Admin;

use App\Http\Filters\HousingsVerifyLogFilter;
use App\Models\HousingsVerifyLog;
use App\Http\Requests\HousingsVerifyLogRequest;
use App\Http\Resources\HousingsVerifyLogResource;
use Illuminate\Http\Request;

class HousingsVerifyLogController extends Controller
{
    public function index(HousingsVerifyLogFilter $filter)
    {
        $housingsVerifyLogs = HousingsVerifyLog::query()
            ->filter($filter)
            ->paginate();
        return $this->ok(HousingsVerifyLogResource::collection($housingsVerifyLogs));
    }

    public function create()
    {
        return $this->ok();
    }

    public function store(HousingsVerifyLogRequest $request)
    {
        $inputs = $request->validated();
        $housingsVerifyLog = HousingsVerifyLog::create($inputs);

        return $this->created(HousingsVerifyLogResource::make($housingsVerifyLog));
    }

    public function edit(Request $request, HousingsVerifyLog $housingsVerifyLog)
    {
        return $this->ok(HousingsVerifyLogResource::make($housingsVerifyLog));
    }

    public function update(HousingsVerifyLogRequest $request, HousingsVerifyLog $housingsVerifyLog)
    {
        $inputs = $request->validated();
        $housingsVerifyLog->update($inputs);

        return $this->created(HousingsVerifyLogResource::make($housingsVerifyLog));
    }

    public function destroy(HousingsVerifyLog $housingsVerifyLog)
    {
        $housingsVerifyLog->delete();
        return $this->noContent();
    }
}
